package com.edu.project.test.model;

import android.util.Log;

import com.edu.project.bean.Weather;
import com.edu.project.http.HttpResultSubscriber;
import com.edu.project.http.RequsetApi;
import com.edu.project.test.presenter.HttpResultPresenter;
import com.edu.project.test.presenter.TestPrensenter;

/**
 * Created by sheng on 2016/11/8.
 */
public class WeatherModel {

    private TestPrensenter mPresenter;

    public WeatherModel(TestPrensenter mPresenter) {
        this.mPresenter = mPresenter;
    }

    public void loadData() {
        Log.e("Mvp ----> ","3");
        RequsetApi.getWeathwerData(new HttpResultSubscriber<Weather>(){
            @Override
            public void onResultSuccess(Weather weather) {
                super.onResultSuccess(weather);
                mPresenter.loadDataSuccess(weather);
            }

            @Override
            public void onResultError(Throwable e) {
                super.onResultError(e);
                mPresenter.loadDataFailure(e);
            }
        });
    }

    public void login(String name, String password) {
        mPresenter.getLoginResult("姓名："+name+" 密码："+password);

    }




}
